﻿using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;

namespace ABCNet.Migrations
{
    public partial class add_Product_and_Order : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "Bank",
                table: "AbpUsers",
                maxLength: 32,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "BankCardNumber",
                table: "AbpUsers",
                maxLength: 32,
                nullable: true);

            migrationBuilder.CreateTable(
                name: "N_Order",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    Consignee = table.Column<string>(maxLength: 32, nullable: true),
                    ConsigneeAddredd = table.Column<string>(maxLength: 256, nullable: true),
                    ConsigneeTel = table.Column<string>(maxLength: 32, nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    ExpressCompanyName = table.Column<string>(maxLength: 32, nullable: true),
                    ExpressNumber = table.Column<string>(maxLength: 32, nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    OrderState = table.Column<int>(nullable: false),
                    ProductId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_N_Order", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "N_Product",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    ProductName = table.Column<string>(maxLength: 32, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_N_Product", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "N_Order");

            migrationBuilder.DropTable(
                name: "N_Product");

            migrationBuilder.DropColumn(
                name: "Bank",
                table: "AbpUsers");

            migrationBuilder.DropColumn(
                name: "BankCardNumber",
                table: "AbpUsers");
        }
    }
}
